package com.lagou.vo;

import java.io.Serializable;

/**
 * @author: wudong
 * @create: 2021-08-03 17:08
 **/
public class ResponseContent implements Serializable {

    private int code;

    private String message;

    private Object value;

    private String desc;

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static ResponseContent success() {
        return buildSuccessResponseContent(null);
    }

    public static ResponseContent buildSuccessResponseContent(Object returnValue) {
        ResponseContent result = new ResponseContent();
        result.setCode(2000);
        result.setMessage(null);
        result.setValue(returnValue);
        return result;
    }

    public static ResponseContent buildErrorResponseContent(int code, String message,String desc) {
        ResponseContent result = new ResponseContent();
        result.setCode(code);
        result.setMessage(message);
        result.setDesc(desc);
        return result;
    }

    public static ResponseContent buildErrorResponseContent(int code, String message) {
        return buildErrorResponseContent(code,message,"");
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

}